from langchain.memory import ConversationBufferMemory, ConversationBufferWindowMemory, ConversationTokenBufferMemory
from MyLangChain import get_llm

# history = ConversationBufferMemory()
# history.save_context({"input": "你好啊"}, {"output": "你也好啊"})
# print(history.load_memory_variables({}))
# history.save_context({"input": "你再好啊"}, {"output": "你又好啊"})
# print(history.load_memory_variables({}))


# window = ConversationBufferWindowMemory(k=2)
# window.save_context({"input": "第一轮问"}, {"output": "第一轮答"})
# window.save_context({"input": "第二轮问"}, {"output": "第二轮答"})
# window.save_context({"input": "第三轮问"}, {"output": "第三轮答"})
# print(window.load_memory_variables({}))


# memory = ConversationTokenBufferMemory(
#     llm=get_llm(),
#     max_token_limit=40
# )
# memory.save_context(
#     {"input": "你好啊"}, {"output": "你好，我是你的AI助手。"})
# memory.save_context(
#     {"input": "你会干什么"}, {"output": "我什么都会"})
#
# print(memory.load_memory_variables({}))
